package org.example.petitionplatformsystem.converter;

import org.example.petitionplatformsystem.dao.model.LeaderMailbox;
import org.example.petitionplatformsystem.dto.mailBoxDTO.MailBoxPostDTO;

import java.time.LocalDateTime;

public class MailBoxConverter {
    public static LeaderMailbox convertToLeaderMailBox(MailBoxPostDTO mailBoxPostDTO){
        // 获取当前时间
        LocalDateTime now = LocalDateTime.now();
        LeaderMailbox leaderMailbox = new LeaderMailbox();
        leaderMailbox.setUserID(mailBoxPostDTO.getUserID());
        leaderMailbox.setLeader_Dep(mailBoxPostDTO.getLeaderDep());
        leaderMailbox.setLeaderName(mailBoxPostDTO.getLeaderName());
        leaderMailbox.setMessageContent(mailBoxPostDTO.getMessageContent());
        leaderMailbox.setStatus("待处理");
        leaderMailbox.setCreatedAt(now);

        return leaderMailbox;
    }
}
